from appium.webdriver.common.appiumby import AppiumBy

from basic.basepage import BasePage
from page.page_navigate_main import PageMain


class PageGoodsCategory(BasePage):
    def goto_goods_details(self):
        """
        点击商品，进入商品详情页
        :return:
        """
        from page.page_features_goods_details import PageGoodsDetails
        locator = (AppiumBy.XPATH,"//*[@text='空调']")
        self.click(locator)
        locator = (AppiumBy.XPATH,"//*[@text='Pro系列']")
        self.click(locator)
        locator = (AppiumBy.XPATH,'//*[@resource-id="com.xiaomi.shop.plugin.productlist:id/product_list_recycler"]/android.widget.FrameLayout[1]')
        self.click(locator)
        return PageGoodsDetails()

if __name__ == '__main__':
    page = PageMain().goto_goods_category().goto_goods_details()